﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


class Student
{
    private string name;       
    private int facNumber;

    public string Name
    {
        get 
        { 
            return name; 
        }
        
        set 
        {
            if (value == string.Empty || value == null)
            {
                throw new ArgumentNullException();
            }
            name = value; 
        }
    }

    public int FacNumber
    {
        get 
        { 
            return facNumber; 
        }

        set 
        {
            if (value < 10000 || value > 99999)
            {
                throw new ArgumentOutOfRangeException(String.Format("Faculty number must be between 10000 and 99999! " +
                                                                     "You entered {0}.", facNumber));
            }
            facNumber = value; 
        }
    }

    public Student()
    {
        this.facNumber = 55555;
        this.name = "random name";
    }

    public Student(string name, int facNumber)
    {
        if (name == string.Empty || name == null)
        {
            throw new ArgumentNullException();
        }
        this.name = name;
        if (facNumber < 10000 || facNumber > 99999)
        {
            throw new ArgumentOutOfRangeException(String.Format("Faculty number must be between 10000 and 99999! " + 
                                                                 "You entered {0}.", facNumber));
        }
        this.facNumber = facNumber;
    }

    public override bool Equals(object obj)
    {
        Student student = obj as Student;
        if (student == null)
            return false;

        if (!Object.Equals(this.name, student.name))
        {
            return false;
        }

        if (this.facNumber != student.facNumber)
        {
            return false;
        }
        return true;
    }

    public override int GetHashCode()
    {
        return this.facNumber.GetHashCode();
    }
}

